/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Laboratorios.java
 *
 * Created on Jan 26, 2015, 3:16:02 PM
 */
package medicamentos;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.Icon;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author MAYRA
 */
public class Laboratorios extends javax.swing.JFrame {

    /** Creates new form Laboratorios */
    DefaultTableModel model;
    public Laboratorios() {
        initComponents();
    desactivar();
        btnNuevo.setEnabled(true);
        
        cargarTablaLaboratorios("","");
                tLaboratorios.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
              @Override
              
            public void valueChanged(ListSelectionEvent e) {
                                               
                  
                try{                     
                  
                if(tLaboratorios.getSelectedRow()!=-1){
                    int fila=tLaboratorios.getSelectedRow();
                   txtCodigo.setText(tLaboratorios.getValueAt(fila,2).toString().trim());
                    txtNombre.setText(tLaboratorios.getValueAt(fila,3).toString().trim());
                    txtDireccion.setText(tLaboratorios.getValueAt(fila,4).toString().trim());
                    txtTelefono.setText(tLaboratorios.getValueAt(fila,5).toString().trim());
                      activar();                    
                    btnGuardar.setEnabled(true);
                    txtCodigo.setEnabled(false);
                }
          }catch (Exception ex) {
           // JOptionPane.showMessageDialog(null, "Error :"+ex);
        }
                  
            }
        });
    } 
    public void guardarLaboratorios()
            
    {
        if(txtCodigo.getText().trim().isEmpty())
        {
            JOptionPane.showMessageDialog(null, "No se puede ingresar un laboratorio sin código");            
            txtCodigo.requestFocus();
        }
        else{
          if(txtNombre.getText().trim().isEmpty()){
              JOptionPane.showMessageDialog(null, "No se puede ingresar un laboratorio sin nombre");
            txtNombre.requestFocus();
              
          }
           if(txtDireccion.getText().trim().isEmpty()){
              JOptionPane.showMessageDialog(null, "No se puede ingresar un laboratorio sin Direccion");
            txtDireccion.requestFocus();   
                        }
                        
        
        else{
                           
       Conexions cc= new Conexions();
                Connection cn = cc.conectar();
                
                String lab_codigo,lab_nombre,lab_direccion,lab_telefono;
                String sql="";
                lab_codigo=txtCodigo.getText();
                lab_nombre=txtNombre.getText();
                lab_direccion=txtDireccion.getText();
                lab_telefono=txtTelefono.getText();
                                          
              sql="insert into laboratorio (LAB_CODIGO,LAB_NOMBRE,LAB_DIRECCION,LAB_TELEFONO) values(?,?,?,?)";
         try {
                PreparedStatement psw= cn.prepareStatement(sql);
                psw.setString(1, lab_codigo);
                psw.setString(2, lab_nombre );
                psw.setString(3,lab_direccion );
                 psw.setString(4,lab_telefono);
                 int n= psw.executeUpdate();// el execute Update devuelve un numero entero debuelve cero si no insertas nada y uno si se inserto
                if(n>0)//si  se inserto
                {
                JOptionPane.showMessageDialog(null, "Se grabo correctamente");
                   cargarTablaLaboratorios("","");
                  limpiar();
                  btnNuevo.setEnabled(true);
                  //btnGuardar.setEnabled(true);
                }
                
        } catch (SQLException ex) {
            
            JOptionPane.showMessageDialog(null, "No se grabo...." +ex);
       } 
       }
       }
      }
    
        
    
    public void limpiar(){
          txtCodigo.setText("");
        txtNombre.setText("");
        txtDireccion.setText("");
        txtTelefono.setText("");
           }
        public void activar(){
           txtCodigo.setEnabled(true);
        txtNombre.setEnabled(true);
        txtDireccion.setEnabled(true);
        txtTelefono.setEnabled(true);
        
    }
    public void desactivar(){
        txtCodigo.setEnabled(false);
        txtNombre.setEnabled(false);
        txtDireccion.setEnabled(false);
        txtTelefono.setEnabled(false);
       
        
    }
      public void activarBoton(){
        btnNuevo.setEnabled(true);
        btnCancelar.setEnabled(true);
        btnGuardar.setEnabled(true);
        
    }
     public void desactivarBoton(){
        btnNuevo.setEnabled(false);
        btnCancelar.setEnabled(false);
        btnGuardar.setEnabled(false);
          } 
    public void cargarTablaLaboratorios(String codigo,String nombre){
        String[] titulos ={"","","CODIGO","NOMBRE","DIRECCION","TELEFONO"};
        String []registros=new String[6];
        String sql;
        Conexions cc=new Conexions();
        Connection cn=cc.conectar();
        
        sql="select *from Laboratorio Where  lab_codigo LIKE '%" +codigo+"%' and lab_nombre LIKE '" +nombre+"%'order by lab_codigo,lab_nombre";
        model=new DefaultTableModel(null,titulos); 
        
        try {
            Statement st=cn.createStatement();
            ResultSet rs=st.executeQuery(sql);
             
            while(rs.next()){
                registros[2]=rs.getString("LAB_CODIGO");
                registros[3]=rs.getString("LAB_NOMBRE");
                registros[4]=rs.getString("LAB_DIRECCION");
                registros[5]=rs.getString("LAB_TELEFONO");
                
              
                
                
                model.addRow(registros);
            }
            tLaboratorios.setModel(model);
            tamaniotabla();
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null,"LA TABLA TIENE PROBLEMAS AL CARGARSE"+ex);
        }
        
        }
    
    public void actualizar(){
        Conexions cc=new Conexions();
        Connection cn=cc.conectar();
        String sql="";
           
        
         sql="update laboratorio SET lab_nombre='"+txtNombre.getText()+"',lab_direccion='"+txtDireccion.getText()+
                  "',lab_telefono='"+txtTelefono+"' where lab_codigo='"+txtCodigo.getText()+"'";
       try {
            PreparedStatement psw =cn.prepareStatement(sql);
            int n=psw.executeUpdate();
            if(n>0){
                JOptionPane.showMessageDialog(null, "Se actualizo correctamente");
                 
		cargarTablaLaboratorios("","");
                     limpiar();
              
                 }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null,"No se actualizo" +ex);
        }
        
    }
    private void actualizarTabla() {
          Conexions cc=new Conexions();
        Connection cn=cc.conectar();
         int fila=tLaboratorios.getSelectedRow();
        String sql="";
        if (fila!=-1) {
                    sql="UPDATE LABORATORIOS "
                + "SET LAB_NOMBRE='"+tLaboratorios.getValueAt(fila,3).toString().trim().toUpperCase()+"',"
                + "LAB_DIRECCION='"+tLaboratorios.getValueAt(fila,4).toString().trim().toUpperCase()+"',"
                + "LAB_TELEFONO='"+tLaboratorios.getValueAt(fila,5).toString().trim()+"'"
                 + "WHERE LAB_CODIGO='"+tLaboratorios.getValueAt(fila, 2).toString()+"'";
        
        try {
            PreparedStatement psw=cn.prepareStatement(sql);
            int n=psw.executeUpdate();
            
            if (n>0) {
                JOptionPane.showMessageDialog(this, "Actualizacion correcta");
                cargarTablaLaboratorios("","");
                limpiar();
                desactivar();
 
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error en la Actualizacion"+e);
        }
        }
    }
    public void  borrar(){
         if(JOptionPane.showConfirmDialog(new JInternalFrame(),
          "Esta seguro de Eliminar el regidtro","Borrar registro",JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION){
 
       Conexions cc=new Conexions();
        Connection cn=cc.conectar();
        String sql="";
        sql="delete from medicamentos where med_codigo='"+txtCodigo.getText()+"'";
                try{
                  PreparedStatement psw=cn.prepareStatement(sql);
                  int n=psw.executeUpdate();
                  if(n>0)
                  {
                      JOptionPane.showMessageDialog(null,"Se elimino correctamente");
                      cargarTablaLaboratorios("","");
                      limpiar();
                  }
                    
                }catch(SQLException ex){
                    JOptionPane.showMessageDialog(null,"NO se elimino");
                }
    }
         
    }
    public void tamaniotabla(){
        Icon img = new javax.swing.ImageIcon("src\\imagenes\\b_edit.png");
        Icon img2 = new javax.swing.ImageIcon("src\\imagenes\\b_drop.png");
        DefaultTableCellRenderer renderer1 = new javax.swing.table.DefaultTableCellRenderer();
        DefaultTableCellRenderer renderer = new javax.swing.table.DefaultTableCellRenderer();
        renderer1.setIcon(img);
        tLaboratorios.getColumnModel().getColumn(0).setCellRenderer(renderer1);
        renderer.setIcon(img2);
        tLaboratorios.getColumnModel().getColumn(1).setCellRenderer(renderer);
        //columna 0
         tLaboratorios.getTableHeader().getColumnModel().getColumn(0).setMaxWidth(20); 
         tLaboratorios.getTableHeader().getColumnModel().getColumn(0).setMinWidth(20);
         //columna 1
         tLaboratorios.getTableHeader().getColumnModel().getColumn(1).setMaxWidth(20); 
         tLaboratorios.getTableHeader().getColumnModel().getColumn(1).setMinWidth(20);
         //columna 2
         tLaboratorios.getTableHeader().getColumnModel().getColumn(2).setMaxWidth(85); 
         tLaboratorios.getTableHeader().getColumnModel().getColumn(2).setMinWidth(85);
         //columna 3
         tLaboratorios.getTableHeader().getColumnModel().getColumn(3).setMaxWidth(85); 
         tLaboratorios.getTableHeader().getColumnModel().getColumn(3).setMinWidth(85);
         //columna 4
         tLaboratorios.getTableHeader().getColumnModel().getColumn(4).setMaxWidth(85); 
         tLaboratorios.getTableHeader().getColumnModel().getColumn(4).setMinWidth(85);
         //columna 5
         tLaboratorios.getTableHeader().getColumnModel().getColumn(5).setMaxWidth(80); 
         tLaboratorios.getTableHeader().getColumnModel().getColumn(5).setMinWidth(80);
         
          }
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txtCodigo = new javax.swing.JTextField();
        txtNombre = new javax.swing.JTextField();
        txtDireccion = new javax.swing.JTextField();
        txtTelefono = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        btnNuevo = new javax.swing.JButton();
        btnGuardar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tLaboratorios = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("LABORATORIOS");

        jLabel2.setText("CODIGO");

        jLabel3.setText("NOMBRE");

        jLabel4.setText("DIRECCION");

        jLabel5.setText("TELEFONO");

        txtCodigo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCodigoActionPerformed(evt);
            }
        });
        txtCodigo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCodigoKeyTyped(evt);
            }
        });

        txtNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNombreActionPerformed(evt);
            }
        });
        txtNombre.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtNombreKeyTyped(evt);
            }
        });

        txtDireccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtDireccionActionPerformed(evt);
            }
        });
        txtDireccion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtDireccionKeyTyped(evt);
            }
        });

        txtTelefono.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtTelefonoActionPerformed(evt);
            }
        });
        txtTelefono.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtTelefonoKeyTyped(evt);
            }
        });

        btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/nuevos.jpg"))); // NOI18N
        btnNuevo.setText("NUEVO");
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });

        btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/guardar.jpg"))); // NOI18N
        btnGuardar.setText("GUARDAR");
        btnGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarActionPerformed(evt);
            }
        });

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cancelar.jpg"))); // NOI18N
        btnCancelar.setText("CANCELAR");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnNuevo, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE)
                    .addComponent(btnGuardar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(btnNuevo)
                .addGap(18, 18, 18)
                .addComponent(btnGuardar)
                .addGap(18, 18, 18)
                .addComponent(btnCancelar)
                .addContainerGap(20, Short.MAX_VALUE))
        );

        tLaboratorios.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane1.setViewportView(tLaboratorios);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel1)
                        .addGap(182, 182, 182))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel5))
                                .addGap(50, 50, 50)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtTelefono)
                                    .addComponent(txtDireccion)
                                    .addComponent(txtNombre)
                                    .addComponent(txtCodigo, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE))))
                        .addGap(70, 70, 70)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(51, 51, 51)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1)
                        .addGap(35, 35, 35)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(txtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(50, 50, 50)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(42, 42, 42))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed
// TODO add your handling code here:
    activar();
    txtCodigo.requestFocus();
}//GEN-LAST:event_btnNuevoActionPerformed

private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
// TODO add your handling code here:
    guardarLaboratorios();
}//GEN-LAST:event_btnGuardarActionPerformed

private void txtNombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNombreKeyTyped
// TODO add your handling code here:
    char car = evt.getKeyChar();
        String temp = String.valueOf(car).toUpperCase();
        car = temp.charAt(0);
        evt.setKeyChar(car);
        
        if(txtNombre.getText().length()>=30) 
            evt.consume();
        if((car<'A' || car>'Z')) 
            evt.consume();
     
}//GEN-LAST:event_txtNombreKeyTyped

private void txtDireccionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtDireccionKeyTyped
// TODO add your handling code here:
    char car = evt.getKeyChar();
        String temp = String.valueOf(car).toUpperCase();
        car = temp.charAt(0);
        evt.setKeyChar(car);
        
        if(txtDireccion.getText().length()>=30) 
            evt.consume();
        if((car<'A' || car>'Z')) 
            evt.consume();
     
}//GEN-LAST:event_txtDireccionKeyTyped

private void txtCodigoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodigoKeyTyped
// TODO add your handling code here:
    char car = evt.getKeyChar();
        String temp = String.valueOf(car).toUpperCase();
        car = temp.charAt(0);
        evt.setKeyChar(car);
        
        if(txtCodigo.getText().length()>=30) 
            evt.consume();
        if((car<'A' || car>'Z')&&(car<'0' || car>'9')) 
            evt.consume();
     
}//GEN-LAST:event_txtCodigoKeyTyped

private void txtCodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodigoActionPerformed
// TODO add your handling code here:
   txtNombre.requestFocus();
}//GEN-LAST:event_txtCodigoActionPerformed

private void txtNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNombreActionPerformed
// TODO add your handling code here:
    txtDireccion.requestFocus();
}//GEN-LAST:event_txtNombreActionPerformed

private void txtDireccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDireccionActionPerformed
// TODO add your handling code here:
    txtTelefono.requestFocus();
}//GEN-LAST:event_txtDireccionActionPerformed

private void txtTelefonoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtTelefonoKeyTyped
// TODO add your handling code here:
           char car = evt.getKeyChar();
        if(txtTelefono.getText().length()>=10)  
            evt.consume();
       if ((car<'0' || car>'9' ))
           evt.consume();
      btnGuardar.requestFocus();
}//GEN-LAST:event_txtTelefonoKeyTyped

private void txtTelefonoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTelefonoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtTelefonoActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Laboratorios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Laboratorios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Laboratorios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Laboratorios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Laboratorios().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnGuardar;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tLaboratorios;
    private javax.swing.JTextField txtCodigo;
    private javax.swing.JTextField txtDireccion;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtTelefono;
    // End of variables declaration//GEN-END:variables
}
